package com.lastcrdg.testmvp;

import android.os.Bundle;
import android.support.annotation.Nullable;

/**
 * author：liluo
 * e-mail：lastcrazysun@163.com
 * company：cusc
 * date：2017/8/17 17:19
 * description：
 */

public abstract class BaseMVPActivity<V, T extends BasePresenter<V>> extends BaseActivity {
        
    protected T mPresenter;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mPresenter = createPresenter();
        mPresenter.attach((V)this);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mPresenter.detach();
    }

    protected abstract T createPresenter();
}
